import Vue from 'vue'
import Router from 'vue-router'

// 老的引入方式
/* import Home from 'pages/Home/Home'
import Category from 'pages/Category/Gategory' */
// 异步的引入方式
//页面
//首页
const Home = resolve => require(['@/pages/home/Home'], resolve)

//闪送超市
const Market = resolve => require(['@/pages/market/Market'], resolve)

//购物车
const Cart = resolve => require(['@/pages/cart/Cart'], resolve)

//登录注册页
const Login = resolve => require(['@/pages/login/Login'], resolve)

//选择地址页
const Site = resolve => require(['@/pages/site/Site'], resolve)

//添加地址页
const AddSite = resolve => require(['@/pages/addSite/AddSite'], resolve)

//选择地址页
const SelectSite = resolve => require(['@/pages/selectSite/SelectSite'], resolve)

//修改地址页
const ChangeSite = resolve => require(['@/pages/changeSite/ChangeSite'], resolve)

// 选择地址页
const ProductItem = resolve => require(['@/pages/Product-item/Product-item.vue'], resolve)

//我的
const Mine = resolve => require(['@/pages/mine/Mine'], resolve)

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home
    },
    {
      path: '/market',
      name: 'market',
      component: Market
    },
    {
      path: '/cart',
      name: 'cart',
      component: Cart
    },
    {
      path: '/mine',
      name: 'mine',
      component: Mine
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/site',
      name: 'site',
      component: Site
    },
    {
      path: '/add-site',
      name: 'addSite',
      component: AddSite
    },
    {
      path: '/select-site',
      name: 'select-site',
      component: SelectSite
    },
    {
      path: '/change-site',
      name: 'change-site',
      component: ChangeSite
    },
    {
      path: '/product-item/:id',
      name: 'product-item',
      component: ProductItem
    }
  ]
})
